#include <iostream>
using namespace std;
//对于完整的构造行为，需要通过编译器参数-fno-elide-constructors来获得
class A {
private:
    int a;

public:
    A(int n)
	: a(n)
    {
	cout << "构造" << a << endl;
    }
    A(A& tp)
    {
	a = tp.a + 1;
	cout << "从" << tp.a << "拷贝" << a << endl;
    }
    A(A&& tp)
    {
	a = tp.a + 1;
	cout << "从" << tp.a << "移动" << a << flush << endl;
    }
    ~A()
    {
	cout << "销毁" << a << flush << endl;
    }
    char get_a() { return a; }
};

A test()
{
    A a(1);
    return a;
}

int main(int argc, char* argv[])
{
    A b(test());
    A c = b;
}
